闘本 1.4 回文の順列
提出
code: txt
import Counter from collection
def is_kaibun(s):
lower = s.to_lowercase()
c = Counter(lower)
even = 0
for v in c.value():
if v % 2 == 0:
continue
else:
even += 1
if even > 1:
return False
return True
実行結果
code: zsh
File "/Users/wafuwafu13/Desktop/CtCI-6th-Edition-Python/debug.py", line 1
import Counter from collection
^^^^
File "/Users/wafuwafu13/Desktop/CtCI-6th-Edition-Python/debug.py", line 4, in is_kaibun
lower = s.to_lowercase()
^^^^^^^^^^^^^^
File "/Users/wafuwafu13/Desktop/CtCI-6th-Edition-Python/debug.py", line 7, in is_kaibun
for v in c.value():
^^^^^^^